public class Teacher extends Person {
    private String[] teachingCourses;

    public Teacher(String name, int id) {
        super(name, id);
        this.teachingCourses = new String[3];
    }

    public void assignCourse(String course) {
        for (int i = 0; i < teachingCourses.length; i++) {
            if (teachingCourses[i] == null) {
                teachingCourses[i] = course;
                System.out.println(name + " 分配课程：" + course);
                return;
            }
        }
        System.out.println("课程分配数量已达上限");
    }

    @Override
    public void printSchedule() {
        System.out.println("教师 " + name + " 的授课表：");
        for (String course : teachingCourses) {
            if (course != null) {
                System.out.println("- " + course);
            }
        }
    }
}